package com.regent.central.bill.service.bean.stock;

import com.regent.central.bill.core.storehouse.StockInventoryItemSku;
import com.regent.central.bill.repository.storehouse.StockInventoryItemSkuMapper;
import com.regent.central.bill.service.storehouse.StockInventoryItemSkuService;
import com.regent.central.infrastructure.service.bean.DomainServiceBean;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.*;

@Service
public class StockInventoryItemSkuServiceBean extends DomainServiceBean<StockInventoryItemSkuMapper, StockInventoryItemSku> implements StockInventoryItemSkuService {
    @Override
    public List<String> selectNoAdjustInventoryId(String skuId, String storehouseId, Date startTime, Date endTime) {
        Map<String, Object> goodsMap = new HashMap<String, Object>();
        goodsMap.put("skuId", skuId);
        goodsMap.put("storehouseId", storehouseId);
        goodsMap.put("startTime", startTime);
        goodsMap.put("endTime", endTime);
        List<String> strings = mapper.selectNoAdjustInventoryId(goodsMap);
        if (strings == null) {
            strings = new ArrayList<String>();
        }
        return strings;
    }

    @Override
    public void updateBookStock(String skuId, String nearInventoryId, BigDecimal stock) {
        mapper.updateBookStock(skuId, nearInventoryId, stock);
    }
}
